# class Phone:
#     def __init__(self, brand, price,color):
#         self.brand = brand
#         self.price = price
#         self.color = color
#
#     def phone_power_on(self):
#         print(f'{self.brand}手机开机了')
#
#     def phone_shut_down(self):
#         print(f'{self.brand}手机关机了')
#
#     def phone_take_a_photo(self):
#         print(f'{self.brand}手机拍照了')
#
# if __name__ == '__main__':
#     s1 = Phone('苹果',2000,'白色')
#     s1.phone_power_on()
#     s1.phone_shut_down()
#     s1.phone_take_a_photo()
#
#     s2 = Phone('华为',1000,'黑色')
#     s2.phone_power_on()
#     s2.phone_shut_down()
#     s2.phone_take_a_photo()
#
#
#
# class Master:
#     def __init__(self):
#         self.recipe = '古法'
#     def make_case(self):
#         print(f'{self.recipe}制作煎饼果子')
#
# class Prentice(Master):
#     pass
#
# if __name__ == '__main__':
#     p = Prentice()
#     p.make_case()


# # 定义师父类
# class Master:
#     def __init__(self):
#         self.recipe = '古法煎饼配方'
#
#     def make_case(self):
#         print(f'使用{self.recipe}制作煎饼果子')
#
# # 定义学校类
# class School:
#     def __init__(self):
#         self.recipe = '【启点的商业版煎饼果子配方】'
#
#     def make_case(self):
#         print(f'使用{self.recipe}制作煎饼果子')
#
# # 定义徒弟类
# class Prentice(School,Master):
#     def __init__(self):
#         self.recipe = '{独创的秘制配方}'
#
#     def make_case(self):
#         print(f'使用{self.recipe}制作煎饼果子')
#
#     def make_case_master(self): # 老师傅版
#         Master.__init__(self)
#         Master.make_case(self)  # 可以精准访问
#
#     def make_case_school(self):  # 学校版的
#         School.__init__(self)
#         School.make_case(self)
#
# # 定义徒孙类
#
#
#
# if __name__ == '__main__':
#     p = Prentice()
#     # p.make_case_master()
#
#     p.make_case_school()

# class Student:
#     def __init__(self,name,age,scores):
#         self.name=name
#         self.age=age
#         self.scores=scores
#     def get_name(self):
#         return self.name
#     def get_age(self):
#         return self.age
#     def get_score(self):
#         return max(self.scores.values())
#
# if __name__ == '__main__':
#     student1 = Student("张三", 18, {'语文': 90, '数学': 85, '英语': 95})
#
#     print(f"学生姓名: {student1.get_name()}")
#     print(f"学生年龄: {student1.get_age()}")
#     print(f"最高分数: {student1.get_score()}")

class Listinfo:
    def __init__(self,varlist):
        self.varlist=varlist

    def add_key(self,keyname):
        self.varlist.append(keyname)
        return self.varlist
    def get_key(self,num):
        return self.varlist[num]
    def update_list(self,list):
        self.varlist.extend(list)
        return self.varlist
    def del_key(self):
        del self.varlist[len(self.varlist)-1]


if __name__ == '__main__':
    list_info = Listinfo([1, 2, 3])
    # 添加元素
    print("添加元素:", list_info.add_key("hello"))  # [1, 2, 3, 'hello']
    # 获取元素
    print("获取索引为2的元素:", list_info.get_key(2))  # 3
    # 合并列表
    print("合并列表:", list_info.update_list([7, 8, 9]))  # [1, 2, 3, 'hello', 100, 7, 8, 9]
    # 删除最后一个元素
    print("当前列表:", list_info.varlist)  # [1, 2, 3, 'hello', 100, 7, 8]